package com.scfire.security

import com.scfire.security.Authority;

/**
 * Copyright 2015 Shudao Info Tech Co. Ltd.  All rights reserved.
 * @author lhzeng
 * @email zenglh@haoshudao.com
 * @date 2015年6月7日 下午1:25:20
 * @version V1.0
 */
class Authority {

	String authority
	
	static Authority create(String authority, boolean flush = false) {
		def instance
		if(!Authority.findByAuthority(authority)){
			instance = new Authority(authority: authority)
			instance.save(flush: flush, insert: true)
		}
		instance
	}

	static mapping = {
		cache true
	}

	static constraints = {
		authority blank: false, unique: true
	}
}
